package task;

/**
 * @Author Weton Li
 * @Date 2021/3/16 21:19
 */
public class FixedBonusServiceImpl implements FixedBonusService {

    private int fixedBonusNum = 2000; // 2000

    double GMVrate1 = 0; // 奖金比例
    double CRrate1 = 0;
    double RTrate1 = 0;

    double salary1 = 0;
    FixedBonus fixedBonus = new FixedBonus();

    /**
     * 计算固定奖金
     * @param GMVinput 用户GMV
     * @param CRinput
     * @param RTinput
     * @return 返回固定奖金 金额
     */
    @Override
    public double getFixedSalary(int GMVinput, double CRinput, double RTinput) {

        if (GMVinput > fixedBonus.GMVgoal) { // 11万>10万
            GMVrate1 = fixedBonus.GMVrate;
        }

        if (CRinput > fixedBonus.CRgoal) { // 0.49 < 0.50
            CRrate1 = fixedBonus.CRrate;
        }

        if (RTinput < fixedBonus.RTgoal) { // 40.1 < 55秒 达标
            RTrate1 = fixedBonus.RTrate;
        }

        salary1 = fixedBonusNum*(GMVrate1+CRrate1+RTrate1); // 计算固定奖金
        return salary1;

    }
}
